package com.walker.elk.netty.socket.client;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

public class WalkerNettyClientChannelHandler extends SimpleChannelInboundHandler<String> {
	
	
	static int i = 1;
	@Override
	public void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
		System.out.println("==================================" + msg);
		ctx.writeAndFlush("client walker send message!" + i++);

	}

	@Override
	public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
		cause.getStackTrace();
		ctx.close();
	}

	@Override
	public void channelActive(ChannelHandlerContext ctx) throws Exception {
		ctx.writeAndFlush("client send active message");
	}
	
	
}
